import request from '../utils/request'

/**
 * 分页多条件获取分类信息
 * @param query
 * @returns {*}
 */
export function getPageCategory(query) {
  return request({
    url: '/category/getCategoryPage',
    method: 'get',
    params: query
  })
}

/**
 * 获取全部分类
 * @returns {*}
 */
export function getAllCategory() {
  return request({
    url: '/category/getAllCategory',
    method: 'get'
  })
}

/**
 * 新增分类
 * @param data
 * @returns {*}
 */
export function addCategory(data) {
  return request({
    url: '/category/addCategory',
    method: 'post',
    data: data
  })
}

/**
 * 删除分类
 * @param ids
 * @returns {*}
 */
export function deleteCategory(ids) {
  return request({
    url: '/category/deleteCategory/'+ids,
    method: 'delete',
  })
}

/**
 * 根据分类ID获取分类信息
 * @param id
 * @returns {*}
 */
export function getCategoryById(id) {
  return request({
    url: '/category/getCategoryById/'+id,
    method: 'get',
  })
}

/**
 * 修改分类
 * @param data
 * @returns {*}
 */
export function updateCategory(data) {
  return request({
    url: '/category/updateCategory',
    method: 'put',
    data:data
  })
}


